package com.gopay.common.constants.dic;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName ExPayApiChannelBankEnum
 * @description 快捷支付API通道银行返回码字典维护
 * @date on 2017/08/02 17:33:40
 */
public enum ExPayApiChannelBankEnum {
    EXPAY_CHANNEL_BANK_CEB("CEB","光大银行"),
    EXPAY_CHANNEL_BANK_SPDB("SPDB","浦发银行"),
    EXPAY_CHANNEL_BANK_CITIC("CITIC","中信银行"),
    EXPAY_CHANNEL_BANK_IPAY("IPAY","民生i支付"),
    EXPAY_CHANNEL_BANK_PAB("PAB","平安快捷"),
    EXPAY_CHANNEL_BANK_CMBCADPAY("CMBCADPAY","民生代扣"),
    EXPAY_CHANNEL_BANK_ICBC("ICBC","工商银行"),
    EXPAY_CHANNEL_BANK_SPDBADPAY("SPDBADY","浦发代扣"),
    EXPAY_CHANNEL_BANK_NUCCPAY("NUCCPAY","网联支付")

    ;
    private final String code;
    private final String bankName;

    public String getCode() {
        return code;
    }

    public String getBankName() {
        return bankName;
    }

    ExPayApiChannelBankEnum(String code, String bankName) {
        this.code = code;
        this.bankName = bankName;
    }

    /**
     * @description 将枚举映射为map对象
     * @param
     * @return java.util.Map
     * @date on 2017/08/03 09:49:35
     */
    public static Map getBankInfos() {
        ExPayApiChannelBankEnum[] vs = ExPayApiChannelBankEnum.values();
        Map<String, String> map = new HashMap<>();
        for (ExPayApiChannelBankEnum ce : vs) {
            map.put(ce.getCode(),ce.getBankName());
        }
        return map;
    }

    public static String getEnumByBankInterfaceChannel(String bankInterfaceChannel) {
        if(bankInterfaceChannel != null) {
            switch (bankInterfaceChannel) {
                case "15" :     //中信银行
                    return EXPAY_CHANNEL_BANK_CITIC.code;
                case "11" :     //民生代扣
                    return EXPAY_CHANNEL_BANK_CMBCADPAY.code;
                case "13" :     //民生i支付
                    return EXPAY_CHANNEL_BANK_IPAY.code;
                case "19" :     //浦发代扣
                    return EXPAY_CHANNEL_BANK_SPDBADPAY.code;
                case "18":      //网联支付
                	return EXPAY_CHANNEL_BANK_NUCCPAY.code;
                default:
                    return null;
            }
        }
        return null;
    }
}
